[#ftl]
<style>
label.error {
    color: Red;
    font-size: 13px;
    margin-left: 5px;
    padding-left: 16px;
}
</style>
<script type="text/javascript">   

/*弹出提醒框*/
function tips(param){
       var d=dialog({
                content: param,
                icon: 'succeed',
                fixed: true,
                lock: true,
            });
            d.show();
            setTimeout(function () {
                d.close().remove();
            }, 2000);
            return false;
} 

function changeParent(){
        var selectedId=$("#industryId").val();
        d=dialog({
            url:'${base}/uyo/platIndustry/dataTree?selectedId='+selectedId,  
            title: '选择文章分类',
          //  background: '#EEE', // 背景色
            opacity: 0.05,  // 透明度
            width: 300,
            height: 350
          });   
          d.show();
}
/*清空父类*/
function cleanParent(){
      $("#parentId").val(null); 
      $("#industryId").val(null); 
      $("#industryName").val(''); 
}
</script>
</head>
<body>
<!-- 主要内容开始 -->
    <form id="dataform"  method="POST">
        <input type="hidden" name="parentId" id="parentId" value="${(parent.id)!}">
        <input type="hidden" name="industryId" id="industryId" value="${(parent.id)!}">
        <input type="hidden" name="industryCode" id="industryCode">
        <table id="add_table" class="category-table">
           <tr class="shop-1">
              <td class="td-2">父类</td>
              <td class="fl"><input type="text" id="industryName" name="industryName" value="${(parent.name)!''}"  readonly="readonly">
                   <input type="button" class="select-btn"  value="选择" onclick='changeParent()'>
                   <input type="button" class="select-btn"  value="清空" onclick='cleanParent()'></td>
           </tr>
           <tr class="shop-3">
              <td class="td-2">所属</td>
              <td class="fl">[@c.select id="ownerId"  datas="store.industry.ownerid"/]</td>
           </tr>
           <tr class="shop-1">
              <td class="td-2"><span class="red">*</span>名称</td>
              <td class="fl"><input type="text" class="required" maxlength='30' id="name" name="name"></td>
           </tr>
           <tr class="shop-1">
              <td class="td-2"><span class="red">*</span>代码</td>
              <td class="fl"><input type="text" class="required" id="code" name="code"></td>
           </tr> 
           <tr class="shop-1">
              <td class="td-2">序号</td>
              <td class="fl"><input type="text" id="sequence" name="sequence"></td>
           </tr>
           <tr class="shop-3">
              <td class="td-2">状态</td>
              <td class="fl"><select name="status">
                               <option value='0'>正常</option>
                               <option  value='1'>禁用</option>
                            </select>
              </td>
           </tr>    
        </table>
           <div class="pro-btn pt30">
              <div class="tc" colspan="2">
                    <input class="btn_2" type="button" id="butSave" value="保存">
                    <input class="btn_2" type="button" id="butCancel" value="取消">
              </div>
           </div>
    </form>
<script type="text/javascript"> 
  $(function() {
        // 保存
        $("#butSave").click(function(){ 
            $("#parentId").val( $("#industryId").val() );                        
            $("#dataform").submit();          
         });

        var v = jQuery("#dataform").validate({
             submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url:"${base}/uyo/platIndustry/add",
                    success: function(data){  
                        noty({
                          text:extendMessages(data).msg.message,
                          layout:"center",
                          timeout:2000,
                          callback:{
                             afterClose:function(){
               //                         window.parent.d.close().remove();
                                        }
                           }
                        });
                   }
                });
            }
       });
       
       $("#butCancel").click(function(){
   //         window.parent.d.close().remove();  
              window.location.reload();          
       });    
  });
</script>
</body>

</html>